<?php
/**
 * Created by PhpStorm.
 * User: 24369
 * Date: 2021/6/25
 * Time: 21:28
 */
namespace app\admin\logic;

use app\admin\validate\BrandValidate;
use think\exception\ValidateException;
use think\facade\Request;

class BrandLogic{
    public static function getwhere()
    {
        $param=Request::param();
        $where=[];
        if (isset($param['recommended'])&&$param['recommended'] != '')        $where['recommended']=$param['recommended'];
        if (isset($param['if_show'])&&$param['if_show'] != '')                $where['if_show']=$param['if_show'];
        if (isset($param['keywords'])&&$param['keywords'] != '')              $where['keywords']=$param['keywords'];
        return  $where;
    }
    public static function getBrandData()
    {
        $post=Request::post();
        $msg='';
        try{
            validate(BrandValidate::class)->check($post);
        }catch (ValidateException $validateException){
            $msg=$validateException->getMessage();
        }
        return [$msg,$post];
    }
}